# Web Portal for Living Resource in Eastside, WA

This project, Web Portal for Living Resources in Eastside, WA, aims to connect homeless and underserved community members with essential living resources such as shelters, food banks, and medical services. Utilizing GIS technology and participatory mapping, the platform allows users to visualize accessible resources within a specified travel time and contribute local knowledge to keep the data current. The project emphasizes user-centric design and mobile responsiveness, ensuring accessibility and engagement. Future enhancements include AI integration for real-time data and multilingual support.

This project is built using SvelteKit, MapBox, and MongoDB. Although the demo maps out the living resources in Eastside, WA, one can easily adapt this to their own city. Follow the instructions below to set up the project, connect to the database, and customize configurations.

## Prerequisites

- Node.js (v14 or higher)
- npm (v6 or higher) or yarn or pnpm

## Setting Up the Project

1. **Clone the repository:**

   ```bash
   git clone <repository-url>
   cd <repository-directory>
   ```

2. **Install dependencies:**

   ```bash
   npm install
   # or
   yarn install
   # or
   pnpm install
   ```

3. **Start the development server:**

   ```bash
   npm run dev
   # or
   yarn dev
   # or
   pnpm dev
   ```

   To start the server and open the app in a new browser tab:

   ```bash
   npm run dev -- --open
   ```

## Connecting to the MongoDB Database and Mapbox API

1. **Set up environment variables:**

   Create a [.env](http://_vscodecontentref_/#%7B%22uri%22%3A%7B%22%24mid%22%3A1%2C%22fsPath%22%3A%22d%3A%5C%5Cmapbox%20gis%20homeless%5C%5C.env%22%2C%22_sep%22%3A1%2C%22path%22%3A%22%2Fd%3A%2Fmapbox%20gis%20homeless%2F.env%22%2C%22scheme%22%3A%22file%22%7D%7D) file in the root directory and add the following variables:

   ```env
   PUBLIC_MAPBOX_TOKEN=<your-mapbox-api-token>
   MONGO_STRING=<your-mongodb-connection-string>
   ```

2. **Configure database settings:**

   The database configuration is located in config.js. You can customize the database name and collection name:

   ```js
   export const DATABASE_NAME = 'db';
   export const COLLECTION_NAME = 'resources';
   ```

3. **Additional Config Variables:**

Additional configuration variables are located in config.js. You can customize the following variables:

```js
export const CITY_NAME = 'Eastside, WA'; // Change this to your city name

export const RESOURCES = ['Food Bank', 'Medical Assistance', 'Safe Parking', 'Shelter'];
export const RESTRICTED_RESOURCES = ['Food Bank', 'Shelter'];

export const ICONS = {
	'Food Bank': '/food.png',
	'Medical Assistance': '/hospital.png',
	'Safe Parking': '/parking.png',
	Shelter: '/house.png'
};
```

4. **Baseline Data to MongoDB**

Baseline data for the MongoDB cluster can be found in the assets directory. You can use this data to populate your database.

## Building the Project

To create a production version of your app:

```bash
npm run build
# or
yarn build
# or
pnpm build
```
